/*
 * Copyright (c) 2023 iQi.Co.Ltd. All rights reserved.
 */
 
using IQIGame.Onigao.Framework;
using System.Collections.Generic;
using System.Linq;
using System;
using NetProtocol.Enum;

namespace NetProtocol.POD {

	/// <summary>
	/// 
	/// module : mall
	/// </summary>
	public class NotifyRechargePOD : IPOD 
    {
        public readonly static Func<NotifyRechargePOD> FACTORY = () => new NotifyRechargePOD();
		public static Func<NotifyRechargePOD> DynamicFactory = FACTORY;
        
		/*-- members --*/
		/// <summary>
        /// sdk的订单id
        /// </summary>
		public string order_id;
		/// <summary>
        /// 游戏cp的订单id
        /// </summary>
		public string game_order_id;
		/// <summary>
        /// 获的的付费点
        /// </summary>
		public int getPayPoint;
		/// <summary>
        /// 额外奖励	
        /// </summary>
        private List<ItemShowPOD> m_exBonus;
		/// <summary>
        /// 商品id
        /// </summary>
		public int goodsId;
		/// <summary>
        /// 金额
        /// </summary>
		public double amount;
		
		
        public List<ItemShowPOD> exBonus
        {
            get
            {
                if(m_exBonus == null)
                {
                    m_exBonus = new();
                }
                return m_exBonus;
            }
            private set => m_exBonus = value;
        }
        public List<ItemShowPOD> unsafe_exBonus
        {
        	get => m_exBonus;
        	set => m_exBonus = value;
        }
		
		/*-- constructors --*/
		public NotifyRechargePOD() {}
		public NotifyRechargePOD(string order_id, string game_order_id, int getPayPoint, List<ItemShowPOD> exBonus, int goodsId, double amount) {
			this.order_id = order_id;
			this.game_order_id = game_order_id;
			this.getPayPoint = getPayPoint;
			this.m_exBonus = exBonus;
			this.goodsId = goodsId;
			this.amount = amount;
		}
	      public void Serial(SOutputStream _out) {
            _out.Write_string(order_id);
            _out.Write_string(game_order_id);
            _out.Write_int(getPayPoint);
            _out.Write_list_pod(m_exBonus);
            _out.Write_int(goodsId);
            _out.Write_double(amount);
        }
        
        public void UnSerial(SInputStream _in) {
            if(!_in.HasRemaining()) return;
            order_id = _in.Read_string();
            if(!_in.HasRemaining()) return;
            game_order_id = _in.Read_string();
            if(!_in.HasRemaining()) return;
            getPayPoint = _in.Read_int();
            if(!_in.HasRemaining()) return;
            m_exBonus = _in.Read_list_pod<ItemShowPOD>(ItemShowPOD.DynamicFactory);
            if(!_in.HasRemaining()) return;
            goodsId = _in.Read_int();
            if(!_in.HasRemaining()) return;
            amount = _in.Read_double();
        }
		
		public NotifyRechargePOD Clone() {
            NotifyRechargePOD o = DynamicFactory();
            o.order_id = order_id;
            o.game_order_id = game_order_id;
            o.getPayPoint = getPayPoint;
            if (m_exBonus != null) {
                o.m_exBonus = m_exBonus.ConvertAll(o => o?.Clone());
            }
            o.goodsId = goodsId;
            o.amount = amount;
            return o;
        }
        
        public void Clear() {
            order_id = default;
            game_order_id = default;
            getPayPoint = default;
            m_exBonus = default;
            goodsId = default;
            amount = default;
        }
		
        public override string ToString() {
			string str = "";
			str += "NotifyRechargePOD [";
			str += "order_id=";
			str += order_id;
			str += ", game_order_id=";
			str += game_order_id;
			str += ", getPayPoint=";
			str += getPayPoint;
			str += ", exBonus=";
			str += m_exBonus.ToString<ItemShowPOD>();
			str += ", goodsId=";
			str += goodsId;
			str += ", amount=";
			str += amount;
			str += "]";
			return str;
		}
		
	}
}